<?php

namespace IDock\Insurance\TPBX\Response;

use IDock\Http\Response;
use IDock\IDock\IDockEnums;
use IDock\Insurance\AICS\Response\AllAICSResponse;
use IDock\Insurance\AICS\Response\PolicyInfoResponse;
use IDock\Printer\ProposalStatusPrinter;

class ProposalStatusResponse extends AllTPBXResponse
{
    /**
     * @var ProposalStatusPrinter $printer
     */
    public $printer = ProposalStatusPrinter::class;

    public function printerInit(): Response
    {
        $data = $this->getBody()['data']['orderList'][0] ?? [];

        $this->printer->policyNo = $data['policyNo'] ?? '';
        $this->printer->messageTip = $data['underwriteOpinionDesc'] ?? '';
        $status = $data['orderStatus'] ?? '1';
        if($status == '1'){
            //人工
            $this->printer->statusCode = 'U3';
        }
        if($status == '2'){
            //已支付
            $this->printer->statusCode = 'U5';
        }
        if($status == '3' or $status == '6'){
            //退回修改
            $this->printer->statusCode = 'U2';
        }
        if($status == '4'){
            //人工
            $this->printer->statusCode = 'U1';
        }
        return $this;
    }
}
